package com.whlilong.jxc.ui.provider;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;

import com.whlilong.jxc.constants.IAppConstants;
import com.whlilong.jxc.model.Sysfun;
import com.whlilong.jxc.sys.CacheImage;
import com.whlilong.jxc.sys.IImageKey;

public class SysFunctionLableProvider implements ITableLabelProvider {

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		// TODO Auto-generated method stub
			if(element instanceof Sysfun){
			Sysfun sysfun = (Sysfun)element;	
				
				switch(columnIndex){
				case 1:
					int no = sysfun.getId();
					if(no == 1)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.INFODANGAN_ICON);
					if(no == 2)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.CAIGOUGUANLI_ICON);
					if(no == 3)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.PIFAXIAOSHOU_ICON);
					if(no == 4)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.MAICHANGGUANLI_ICON);
					if(no == 5)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.KUCUNGUANLI_ICON);
					if(no == 6)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.CAIWUJIESUAN_ICON);
					if(no == 7)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.JINKAZHONGXIN_ICON);
					if(no == 8)
						return CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.XITONGGONGNENG_ICON);
					
				}
			}
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		if(element instanceof Sysfun && columnIndex == 1){
			Sysfun sysfun = (Sysfun)element;
			return sysfun.getFunname();
		}
		
		return null;
		
	}
	


	@Override
	public void addListener(ILabelProviderListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean isLabelProperty(Object element, String property) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener listener) {
		// TODO Auto-generated method stub

	}

}
